﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SmartCity.EventHandle.API.Read.Application.Commands;
using SmartCity.EventHandle.API.Read.DTO;
using SmartCity.EventHandle.Errorcode;

namespace SmartCity.EventHandle.API.Read.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;
        private readonly Logger<ManagementController> logger;

        public ManagementController(IMediator mediator,Logger<ManagementController> logger)
        {
            this.mediator = mediator;
            this.logger = logger;
        }

        /// <summary>
        /// 获取我的代办列表
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回我的代办任务</returns>
        [HttpGet]
        public Task<ApiResult<List<InstanceDto>>> MyPending([FromQuery]MyPendingQueryCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取实例
        /// </summary>
        /// <param name="request">命令</param>
        /// <returns>返回获取实例任务</returns>
        [HttpGet]
        public Task<ApiResult<InstanceDto>> GetInstance([FromQuery]InstanceQueryCommand request)
        {
            return mediator.Send(request);
        }
    }
}
